<?php /* Smarty version Smarty-3.1.13, created on 2015-05-21 09:34:47
         compiled from ".\templates\reg.html" */ ?>
<?php /*%%SmartyHeaderCode:16986555d4db1b32362-97015451%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '28515da26d9e78e698e98e486ea493ca9149485b' => 
    array (
      0 => '.\\templates\\reg.html',
      1 => 1432193680,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '16986555d4db1b32362-97015451',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.13',
  'unifunc' => 'content_555d4db1baf387_66982827',
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_555d4db1baf387_66982827')) {function content_555d4db1baf387_66982827($_smarty_tpl) {?><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
<title>用户注册</title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<link rel="stylesheet" href="lib/css/bootstrap.css">
<link rel="stylesheet" href="lib/css/font-awesome.css">
<link rel="stylesheet" href="lib/css/style.css">
<link rel="stylesheet" href="lib/css/style.less">
<script src="lib/js/jquery-1.11.0.min.js"></script>
<script src="lib/js/less-1.5.0.min.js"></script>
<script src='lib/js/jquery.validate.min.js'></script>
<script src="lib/js/bootstrap.js"></script>
<script src="lib/js/bootbox.js"></script>
<script>
        $(document).ready(function() {
            function validateform() {
                return $("#form").validate({
                        rules: {
                            'email': {
                                required: true,
                                email:true
                            },
                            'pwd': {
                                required: true,
                            }
                        },
                        messages: {
                            'email': {
                                required: '请填写邮箱',
                                email:'请填写正确的邮箱'
                            },
                            'pwd': {
                                required: '请填写密码'
                            }
                        }
                    }).form();
          }
            

            $("#submit").on('click',function() {
                var result = validateform();
                if(result) {
                   $.ajax({
                     url: 'reg.php',
                     data: 'email='+$("#email").val()+'&pwd='+$("#pwd").val(),
                     type: 'POST',
                     success: function(res) {
                    	 //邮箱注册过
                        if(res==1){
                        	bootbox.alert('邮箱已注册，请登录');
                        }//注册不成功
                        else if(res==2){
                        	bootbox.alert('注册未成功，请再次注册');
                        }//注册成功
                        else if(res==3){
                        	window.location.href="file.php";
                        }
                        
                     }
                   });
                }  
            });
        });
</script>
</head>
<body>
    <div id="validate-container"  class="container body-bg">
        <div id="header" style="height:50px;">
            
        </div>
        <div id="main" >
            <form action="" class="form-inline" id="form">
                <div class="main-div">
                    <div  class="secendary-div  ">邮箱</div>
                    <input type="text"  class="secendary-input form-control " id="email" name="email" >
                </div>
                <div class="main-div">
                    <div  class="secendary-div">密码</div>
                    <input type="text"  class="secendary-input form-control" id="pwd" name="pwd" >
                </div>
                     <a href="login.php" class="btn btn-default  btn-xs">
                      登入
                     </a>
               <button type="button"  class="btn btn-default btn-lg" id="submit">注册</button>
            </form>
        </div>
        <div id="footer" >
        </div>
    </div>

</body>
</html>
<?php }} ?>